package com.xjj.test.demo.service.impl;

import com.sword.commons.Commons.Lang.StringUtil;
import com.sword.woodpecker.autotest.framework.exception.TestCaseException;
import com.xjj.test.demo.pageobject.BaiduIndexPO;
import com.xjj.test.demo.service.IBaiDuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 类描述:〈百度搜索service〉
 */
@Service//标记为Service
public class BaiduService implements IBaiDuService {

  @Autowired//自动注入BaiduIndexPO对象，免去手动new
  private BaiduIndexPO baiduIndexPO;

  /**
   * 方法功能描述: 百度搜索关键字
   *
   * @param keyWord 搜索关键字
   * @return void
   */
  @Override
  public void search(String keyWord) {
    //参数常规校验
    if (StringUtil.isBlank(keyWord)) {
      throw new TestCaseException("参数非法");
    }
    //输入关键字
    baiduIndexPO.inputKeyWord(keyWord);
    //点击百度一下
    baiduIndexPO.clickSubmitBtn();
  }
}
